<?php
$xtpl = new XTemplate("modules/home/about_us_task.htm");
//--
$UPLOAD = new UPLOAD();
//--
$POST = $_POST;

if($_POST[type] == 'NEW'){	
	$POST['sp_code'] =$POST['code'];
	$POST['sp_name']=$POST['name'];
	$POST['sp_text']= $POST['description'];
        $POST['id_lang'] = $_SESSION['ID_LANG_ADM'];
	//--
	$DB->DBInsert('about_us', $POST);
	//--
	$GUI->redir("?mod=home&act=about_us");
}
elseif($_POST[type] == 'EDIT'){
	$POST['sp_code']	=$POST['code'];
	$POST['sp_name']	=$POST['name'];
	$POST['sp_text']= $POST['description'];

	//--
	$DB->DBUpdate('about_us', $POST, "WHERE sp_id = '".$POST['id']."'");
	//--
	$GUI->redir("?mod=home&act=about_us");
}
//--
//--
if($_GET[id] != ''){
	$row = $DB->FetchData('about_us','*',"WHERE sp_id='".$_GET[id]."'");
	$row[type] = 'EDIT';
	$row[code]=stripslashes($row['sp_code']);
	$row[id]=$row['sp_id'];
	$row[name] = $row['sp_name'];
	
}else{
	$row[type] = 'NEW';
}
//--
//--
$_FCKeditor = new FCKeditor("description");
$_FCKeditor->BasePath = $siteFCKeditorPath;
$_FCKeditor->Width = '95%';
$_FCKeditor->Height = '450';
$_FCKeditor->Value = stripcslashes($row['sp_text']);

$xtpl->assign("write",$row);
//--
//--
$waypathlink = '&raquo;&nbsp;<a href="?mod=home&act=supplier" class="waypath">About Us Management</a>:&nbsp;'.$row[type];
$xtpl_main->assign("waypathlink",$waypathlink);
//--
//--
$save_button = $GUI->button_ren("Save","javascript: doSavenews();");
$xtpl->assign("save_button",$save_button);
//--
$cancel_button = $GUI->button_ren("Cancel","javascript: add('?mod=home&act=about_us');");
$xtpl->assign("cancel_button",$cancel_button);

?>
